<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr=[1,2,5,4,2,3];
        Array.prototype.myFilter=function(handler){
            var arr1=[];
            for(var i=0;i<this.length;i++){
                var item=this[i];
                var result=handler(item);
                if(result){
                    arr1.push(item)
                }
                else{
                    continue
                }
            }
            return arr1
        }
        var result=arr.myFilter(function(item){
          return item==2
        })
        console.log(result)
    </script>
</head>
<body>
    
</body>
</html>